package com.zhuoli.service.springboot.dubbo.consumer.controller;

import com.zhuoli.service.springboot.dubbo.consumer.common.request.SayHelloConsumerRequest;
import com.zhuoli.service.springboot.dubbo.consumer.common.vo.SayHelloConsumerVo;
import com.zhuoli.service.springboot.dubbo.consumer.core.HelloControllerService;
import lombok.AllArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @Author: zhuoli
 * @Date: 2018/8/22 10:37
 * @Description:
 */
@RestController
@RequestMapping(value = "/consumer/hello")
@AllArgsConstructor
public class HelloController {
    private HelloControllerService helloControllerService;

    @RequestMapping(value = "/say_hello", method = RequestMethod.POST)
    public ResponseEntity<SayHelloConsumerVo> sayHello(@Valid @RequestBody SayHelloConsumerRequest request){
        return ResponseEntity.status(HttpStatus.OK).body(helloControllerService.sayHello(request));
    }
}
